home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / GIMP 2.6.8 / gimp-2.6.8-i686-setup.exe / {app} / share / gimp / 2.0 / scripts / textured-logo.scm < prev    next >
Text File  |  2009-12-15  |  8KB  |  179 lines

  1. ;  BLENDED-DROP-SHADOW-LOGO
  2. ;  draw the specified text over a blended background using current gimp fg
  3. ;   and bg colors.  The finished blend has a drop shadow underneath that blends
  4. ;   to the specified bg-color
  5. ;  if the blend colors are specified as high intensity, the sharp option
  6. ;   should be enabled or the logo will come out blurry
  7.  
  8. (define (scale size percent) (* size percent))
  9.  
  10. (define (apply-textured-logo-effect img
  11.                                     logo-layer
  12.                                     b-size
  13.                                     text-pattern
  14.                                     tile-type
  15.                                     bg-color
  16.                                     blend-fg
  17.                                     blend-bg)
  18.   (let* (
  19.         (b-size-2 (scale b-size 0.5))
  20.         (f-size (scale b-size 0.75))
  21.         (ds-size (scale b-size 0.5))
  22.         (ts-size (- b-size-2 3))
  23.         (width (car (gimp-drawable-width logo-layer)))
  24.         (height (car (gimp-drawable-height logo-layer)))
  25.         (blend-layer (car (gimp-layer-new img width height RGBA-IMAGE
  26.                                           "Blend" 100 NORMAL-MODE)))
  27.         (shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  28.                                            "Shadow" 100 NORMAL-MODE)))
  29.         (text-shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  30.                                                 "Text Shadow" 100 MULTIPLY-MODE)))
  31.         (tsl-layer-mask (car (gimp-layer-create-mask text-shadow-layer
  32.                                                      ADD-BLACK-MASK)))
  33.         (drop-shadow-layer (car (gimp-layer-new img width height RGBA-IMAGE
  34.                                                 "Drop Shadow" 100 MULTIPLY-MODE)))
  35.         (dsl-layer-mask (car (gimp-layer-create-mask drop-shadow-layer
  36.                                                      ADD-BLACK-MASK)))
  37.         )
  38.  
  39.     (gimp-context-push)
  40.  
  41.     (script-fu-util-image-resize-from-layer img logo-layer)
  42.     (script-fu-util-image-add-layers img text-shadow-layer drop-shadow-layer blend-layer shadow-layer)
  43.     (gimp-image-raise-layer img text-shadow-layer)
  44.     (gimp-selection-all img)
  45.     (gimp-context-set-pattern text-pattern)
  46.     (gimp-layer-set-lock-alpha logo-layer TRUE)
  47.     (gimp-edit-bucket-fill logo-layer PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  48.     (gimp-selection-none img)
  49.     (gimp-edit-clear text-shadow-layer)
  50.     (gimp-edit-clear drop-shadow-layer)
  51.     (gimp-context-set-background bg-color)
  52.     (gimp-drawable-fill shadow-layer BACKGROUND-FILL)
  53.     (gimp-rect-select img b-size-2 b-size-2 (- width b-size) (- height b-size)
  54.                       CHANNEL-OP-REPLACE TRUE b-size-2)
  55.     (gimp-context-set-background '(0 0 0))
  56.     (gimp-edit-fill shadow-layer BACKGROUND-FILL)
  57.     (gimp-selection-layer-alpha logo-layer)
  58.     (gimp-layer-add-mask text-shadow-layer tsl-layer-mask)
  59.     (gimp-context-set-background '(255 255 255))
  60.     (gimp-edit-fill tsl-layer-mask BACKGROUND-FILL)
  61.     (gimp-selection-feather img f-size)
  62.     (gimp-context-set-background '(63 63 63))
  63.     (gimp-edit-fill drop-shadow-layer BACKGROUND-FILL)
  64.     (gimp-context-set-background '(0 0 0))
  65.     (gimp-edit-fill text-shadow-layer BACKGROUND-FILL)
  66.     (gimp-context-set-foreground '(255 255 255))
  67.  
  68.     (gimp-edit-blend text-shadow-layer FG-BG-RGB-MODE NORMAL-MODE
  69.                      GRADIENT-SHAPEBURST-ANGULAR 100 0 REPEAT-NONE FALSE
  70.                      FALSE 0 0 TRUE
  71.                      0 0 1 1)
  72.  
  73.     (gimp-selection-none img)
  74.     (gimp-context-set-foreground blend-fg)
  75.     (gimp-context-set-background blend-bg)
  76.  
  77.     (gimp-edit-blend blend-layer FG-BG-RGB-MODE NORMAL-MODE
  78.                      GRADIENT-LINEAR 100 0 REPEAT-NONE FALSE
  79.                      FALSE 0 0 TRUE
  80.                      0 0 width 0)
  81.  
  82.     (plug-in-mosaic RUN-NONINTERACTIVE img blend-layer 12 1 1 0.7 TRUE 135 0.2 TRUE FALSE
  83.                     tile-type 1 0)
  84.  
  85.     (gimp-layer-translate logo-layer (- b-size-2) (- b-size-2))
  86.     (gimp-layer-translate blend-layer (- b-size) (- b-size))
  87.     (gimp-layer-translate text-shadow-layer (- ts-size) (- ts-size))
  88.     (gimp-layer-translate drop-shadow-layer ds-size ds-size)
  89.     (gimp-selection-layer-alpha blend-layer)
  90.     (gimp-layer-add-mask drop-shadow-layer dsl-layer-mask)
  91.     (gimp-context-set-background '(255 255 255))
  92.     (gimp-edit-fill dsl-layer-mask BACKGROUND-FILL)
  93.     (gimp-layer-remove-mask drop-shadow-layer MASK-APPLY)
  94.     (gimp-selection-none img)
  95.  
  96.     (gimp-context-pop)
  97.   )
  98. )
  99.  
  100. (define (script-fu-textured-logo-alpha img
  101.                                        logo-layer
  102.                                        b-size
  103.                                        text-pattern
  104.                                        tile-type
  105.                                        bg-color
  106.                                        blend-fg
  107.                                        blend-bg)
  108.   (begin
  109.     (gimp-image-undo-group-start img)
  110.     (apply-textured-logo-effect img logo-layer b-size text-pattern tile-type
  111.                                 bg-color blend-fg blend-bg)
  112.     (gimp-image-undo-group-end img)
  113.     (gimp-displays-flush))
  114. )
  115.  
  116. (script-fu-register "script-fu-textured-logo-alpha"
  117.   _"_Textured..."
  118.   _"Fill the selected region (or alpha) with a texture and add highlights, shadows, and a mosaic background"
  119.   "Spencer Kimball"
  120.   "Spencer Kimball"
  121.   "1996"
  122.   "RGBA"
  123.   SF-IMAGE      "Image"                 0
  124.   SF-DRAWABLE   "Drawable"              0
  125.   SF-ADJUSTMENT _"Border size (pixels)" '(20 1 100 1 10 0 1)
  126.   SF-PATTERN    _"Pattern"              "Fibers"
  127.   SF-OPTION     _"Mosaic tile type"     '(_"Squares"
  128.                                           _"Hexagons"
  129.                                           _"Octagons")
  130.   SF-COLOR      _"Background color"     "white"
  131.   SF-COLOR      _"Starting blend"       '(32 106 0)
  132.   SF-COLOR      _"Ending blend"         '(0 0 106)
  133. )
  134.  
  135. (script-fu-menu-register "script-fu-textured-logo-alpha"
  136.                          "<Image>/Filters/Alpha to Logo")
  137.  
  138. (define (script-fu-textured-logo text
  139.                                  size
  140.                                  fontname
  141.                                  text-pattern
  142.                                  tile-type
  143.                                  bg-color
  144.                                  blend-fg
  145.                                  blend-bg)
  146.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  147.          (b-size (scale size 0.1))
  148.          (text-layer (car (gimp-text-fontname img -1 0 0 text b-size
  149.                                               TRUE size PIXELS fontname))))
  150.     (gimp-image-undo-disable img)
  151.     (apply-textured-logo-effect img text-layer b-size text-pattern tile-type
  152.                                 bg-color blend-fg blend-bg)
  153.     (gimp-image-undo-enable img)
  154.     (gimp-display-new img)
  155.   )
  156. )
  157.  
  158. (script-fu-register "script-fu-textured-logo"
  159.   _"_Textured..."
  160.   _"Create a textured logo with highlights, shadows, and a mosaic background"
  161.   "Spencer Kimball"
  162.   "Spencer Kimball"
  163.   "1996"
  164.   ""
  165.   SF-STRING     _"Text"               "GIMP"
  166.   SF-ADJUSTMENT _"Font size (pixels)" '(200 1 1000 1 10 0 1)
  167.   SF-FONT       _"Font"               "CuneiFont"
  168.   SF-PATTERN    _"Text pattern"       "Fibers"
  169.   SF-OPTION     _"Mosaic tile type"   '(_"Squares"
  170.                                         _"Hexagons"
  171.                                         _"Octagons")
  172.   SF-COLOR      _"Background color"   "white"
  173.   SF-COLOR      _"Starting blend"     '(32 106 0)
  174.   SF-COLOR      _"Ending blend"       '(0 0 106)
  175. )
  176.  
  177. (script-fu-menu-register "script-fu-textured-logo"
  178.                          "<Image>/File/Create/Logos")
  179.